package main


import (
	"golang.org/x/net/context"
	"google.golang.org/grpc"
	"google.golang.org/grpc/reflection"
	user "gogogo/grpc/user"
	"net"
	"log"
)

const (
	port = ":50051"
)

type server struct{}

func (*server) GetUser(ctx context.Context, in *user.GetUserRequest) (*user.GetUserReply, error) {
	return &user.GetUserReply{Message: "1024",}, nil
}

func main() {
	lis, err := net.Listen("tcp", port)
	if err != nil {
		log.Fatalf("failed to listen: %v", err)
	}
	s := grpc.NewServer()
	user.RegisterUserServer(s, &server{})
	// Register reflection service on gRPC server.
	reflection.Register(s)
	if err := s.Serve(lis); err != nil {
		log.Fatalf("failed to serve: %v", err)
	}
}
